Fix typos and think-os to make byte swapping actually swap bytes.
authorrobertl <robertl>
Thu, 18 Jan 2007 17:26:11 +0000 (17:26 +0000)
committerrobertl <robertl>
Thu, 18 Jan 2007 17:26:11 +0000 (17:26 +0000)
alan.c

diff --git a/alan.c b/alan.c
index a93c66175777c620c01d17cf6b160b7d06092c58..aa8f1b883c8492b54e24ac2e752d1b25c4837107 100644 (file)
--- a/alan.c
+++ b/alan.c
@@ -214,7 +214,7 @@ static void sw_bytes(void *word) {
   uint8_t *p = word;
   uint16_t *r = word;
 
-  *r = (uint16_t)(p[0] << 8 | p[1]);
+  *r = (uint16_t)(p[1] << 8 | p[0]);
 }
 static void sw_words(void *dword) {
   uint16_t *p = dword;
@@ -226,7 +226,7 @@ static void rev_bytes(void *dword) {
   uint8_t *p = dword;
   uint32_t *r = dword;
 
-  *r = (uint32_t)(p[0] << 24 | p[1] << 16 | p[2] << 8 | p[0]);
+  *r = (uint32_t)(p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0]);
 }
 
 static void swap_wpthdr(struct wpthdr *wpthdr,